import type { App } from 'vue';
import { SvgIcon } from '@/components/SvgIcon';
import { BaseForm } from '@/components/Form';
import { BaseTable, SearchForm } from '@/components/Table';

/**
 * 全局组件配置接口
 */
interface GlobalComponentConfig {
  name: string;
  component: any;
}

/**
 * 全局组件配置列表
 */
const globalComponentConfigs: GlobalComponentConfig[] = [
  {
    name: 'SvgIcon',
    component: SvgIcon
  },
  {
    name: 'BaseForm',
    component: BaseForm
  },
  {
    name: 'BaseTable',
    component: BaseTable
  },
  {
    name: 'SearchForm',
    component: SearchForm
  }
];

/**
 * 全局组件注册
 * @param app Vue应用实例
 */
export function setupGlobalComponents(app: App) {
  globalComponentConfigs.forEach(config => {
    app.component(config.name, config.component);
  });
}
